<%@page language="java" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@ include file="/view/common/taglib.jsp"%>
<%@ include file="/view/common/variable.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/view/common/head.jsp"%>
<meta name="keywords" content="学而阅读,小说网,原创小说网" />
<meta name="description"
	content="学而阅读,最热门的免费小说网站,提供武侠仙侠,奇幻玄幻,科幻灵异,都市言情,穿越女频,青春校园,历史军事,网游竞技,职业官场等网络热门的书籍下载跟阅读！" />
<title>学而阅读作家后台</title>
<link rel="stylesheet" href="<%=path%>/css/style.css" />
<script type="text/javascript" src="<%=path%>/js/base.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		//全选点击日
		$("#all").click(function() {
			if (this.checked) {
				$("#list :checkbox").prop("checked", true);
			} else {
				$("#list :checkbox").prop("checked", false);
			}
		});

		//设置全选复选框
		$("#list :checkbox").click(function() {
			allchk();
		});

		//删除
		$("#getdel").click(function() {
			var valArr = new Array;
			$("#list :checked").each(function(i) {
				valArr[i] = $(this).val();
			});
			//选择的要删除的书籍章节id
			var vals = valArr.join(',');
			//利用对话框返回的值 （true 或者 false）  
			if (valArr.length == 0) {
				alert("请选择要删除的章节！");
				return;
			}
			if (confirm("确定要删除选中的章节吗？（已选中" + valArr.length + "）")) {
				$("#deleteChapterIds").val(vals);
				submitDeleteForm();
			} else {
				return;
			}
		});

		//批量发布
		$("#getfbx").click(function() {
			var valArr = new Array;
			$("#list :checked").each(function(i) {
				valArr[i] = $(this).val();
			});
			//选择的要发布的书籍章节id
			var vals = valArr.join(',');
			//利用对话框返回的值 （true 或者 false）  
			if (valArr.length == 0) {
				alert("请选择要发布的章节！");
				return;
			}
			if (confirm("确定要发布选中的章节吗？（已选中" + valArr.length + "）")) {
				$("#publishChapterIds").val(vals);
				submitPublishForm();
			} else {
				return;
			}
		});
	});
	function submitDeleteForm() {
		$("#form1").submit();
	}
	function submitPublishForm() {
		$("#form2").submit();
	}
</script>
</head>

<body ng-app="myApp" ng-controller='ShowController'>
	<%@ include file="/view/common/header.jsp"%>
	<div class="content clearfix">
		<%@ include file="/view/common/left.jsp"%>
		<!--右边-->
		<div class="right r">
			<div class="path">
				作品管理 > <span>作品列表</span>
			</div>

			<div class="editnav">
				<ul>
					<li><a href="<%=path%>/book/detail?bookId=${bookId}">作品设置</a></li>
					<li class="editnavo"><a
						href="<%=path%>/chapter/draftList?bookId=${bookId}">草稿箱</a></li>
					<li><a href="<%=path%>/chapter/publishList?bookId=${bookId}">已发布章节</a></li>
				</ul>
				<a href="<%=path%>/chapter/add?bookId=${bookId}" class="addedit"><img
					src="<%=path%>/image/xzzj.png" /></a>
			</div>

			<!--草稿箱-->
			<div class="drafts">

				<div class="draftstop">
					<ul>
						<li><input type="checkbox" id="all" /><i>全选</i></li>
						<li id="getdel"><b><img src="<%=path%>/image/del.png" /></b><span>删除</span></li>
						<li id="getfbx" class="fbx"><b><img
								src="<%=path%>/image/fb.png" /></b><span>发布</span></li>
						<li><font style="color: silver;">(审核中的书籍最多可以发布20章节，上架后不限制，拒绝的书籍不允许发布章节。)</font></li>
					</ul>
				</div>

				<div class="dtable">
					<table cellspacing="0" cellpadding="0" border="0" width="100%"
						id="list">
						<tr>
							<th width="70"></th>
							<th>章节名称</th>
							<th width="120">是否付费</th>
							<th width="100">章节字数</th>
							<th width="150">预定发布时间</th>
							<th width="150">创建时间</th>
							<th width="100">操作</th>
						</tr>
						<c:forEach items="${bookChapterList}" var="bookChapter"
							varStatus="status">
							<tr>
								<td><label><input type="checkbox"
										value="${bookChapter.chapterId}" /></label></td>
								<td class="dtitle">${bookChapter.chapterName}</td>
								<td><c:if test="${bookChapter.chapterFree==1}">
										<font style="color: green;">免费</font>
									</c:if> <c:if test="${bookChapter.chapterFree==2}">
										<font style="color: red;">付费</font>
									</c:if> <c:if test="${bookChapter.chapterFree==0}">
										<font style="color: silver;">未知</font>
									</c:if></td>
								<td>${bookChapter.chapterWords}</td>
								<td>暂未开放</td>
								<td><fmt:formatDate value="${bookChapter.chapterDate}"
										pattern="yyyy-MM-dd HH:mm:ss" /></td>
								<td><a
									href="${path}/chapter/edit?bookId=${bookId}&chapterId=${bookChapter.chapterId}&lastPageNo=${page.pageNo}">编辑</a>&nbsp;|&nbsp;<a
									href="${path}/chapter/review?bookId=${bookId}&chapterId=${bookChapter.chapterId}" target="_blank">预览</a></td>
							</tr>
						</c:forEach>
					</table>
				</div>
				<div>
					<page:page pageSize="${page.limit}" pageNo="${page.pageNo}"
						url="${path}/chapter/draftList?bookId=${bookId}"
						recordCount="${recordCount}" />
				</div>

			</div>
			<!--草稿箱-->
			<form action="<%=path%>/chapter/delete" name="form1" id="form1"
				method="post">
				<input type="hidden" name="bookId" id="bookId" value="${bookId}" />
				<input type="hidden" name="deleteChapterIds" id="deleteChapterIds"
					value="" />
			</form>
			<form action="<%=path%>/chapter/publish" name="form2" id="form2"
				method="post">
				<input type="hidden" name="bookId" id="bookId" value="${bookId}" />
				<input type="hidden" name="publishChapterIds" id="publishChapterIds"
					value="" />
			</form>
		</div>
		<!--右边-->
	</div>

</body>
</html>